package cn.tedu.cgb2110boot01;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/user/userServlet")
public class UserServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //必须是表单 + 必须是method=post的表单,才会触发doPost()
        System.out.println("表单数据已经正确提交");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //除了post提交的方式,大部分情况会触发doGet()
        System.out.println("超链接访问成功~~~");
    }
}
